package main 
import "fmt"

type Person interface {
	eat()
	sleep()
}

type Student struct {
	Name string
	Grade string
}

// 方法是值接收者
func (s Student) eat() {
	fmt.Println("Student eat")
}
func (s Student) sleep() {
	fmt.Println("Student sleep")
}

func main() {
	// 接口值接收对象，可以实现接口
	var p1 Person = Student{
		Name: "Tom",
		Grade: "1",
	}
	p1.eat()
	p1.sleep()

	// 接口指针接收对象，也可以实现接口
	var p2 Person = &Student{
		Name: "Jerry",
		Grade: "2",
	}
	p2.eat()
	p2.sleep()
}